//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package org.pentaho.di.ui.trans.steps.shentong.oss.client;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;

public class ObjectHandler implements HttpResultHandler<ObjectResult> {
    public ObjectHandler() {
    }

    public ObjectResult handleResponse(InputStream inputStream) {
        try {
            byte[] cache = new byte[1048576];
            ByteArrayOutputStream out = new ByteArrayOutputStream();

            int length;
            while((length = inputStream.read(cache)) != -1) {
                out.write(cache, 0, length);
            }

            out.flush();
            byte[] data = out.toByteArray();
            out.close();
            ObjectResult result = new ObjectResult();
            result.setData(data);
            return result;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
